<?php
	echo $this->Html->script(array('ckeditor/ckeditor','ckfinder/ckfinder'));
?>
  <style>
		.keke ul{
			float:left; width:600px; padding-left:5px;
		}
		.keke ul li{
			float:left;
			margin:0px 12px;
			list-style-type: none;
			height:50px;
		}
 </style>  
<script language="javascript" type="text/javascript">
/*<![CDATA[*/
	$(function(){
		$("#lnkSave").click(function(){
			$('#adminForm').submit();
		});

		$("#lnkClose").click(function(){
			window.location = '<?php echo DOMAIN ?>/category_news';
		});
		
		
		$("#adminForm").validate({
			rules: {
				txtName: "required",
				txtOrder: "required",
			},
			messages: {
				txtName: "Bạn chưa nhập tên chuyên mục!",
				txtOrder: "Bạn chưa nhập số thứ tự!",
			}
		});
	});
/*]]>*/
	function Checkvalue(ElementID){
		var checkBox = document.getElementById(ElementID);
		if(checkBox.checked==true)
			checkBox.value=1; 
		else checkBox.value=0; 
	}
</script>
<script>
function keypress(e){
  var keypressed = null;
 if (window.event)
 {
 keypressed = window.event.keyCode; //IE
 }
 else
 { 
 keypressed = e.which; //NON-IE, Standard
 }
 if (keypressed < 48 || keypressed > 57)
 { 
 if (keypressed == 8 || keypressed == 127)
 {//Phím Delete và Phím Back
 return;
 }
 if (keypressed == 45 || keypressed == 32)
 {//Phím Delete và Phím Back
 return true;
 }
 return false;
 }
 }

</script>
<div id="content-box">
	<div class="border">
		<div class="padding">
			<div id="toolbar-box">
   			<div class="t"><div class="t"><div class="t"></div></div></div>
			<div class="m">
				<div class="toolbar" id="toolbar">
				<table class="toolbar">
				<tr>
					<td class="button" id="toolbar-save">
					<a href="javascript:;//Cập nhật" id="lnkSave" class="toolbar">
						<span class="icon-32-save" title="Cập nhật"></span>
						Cập nhật
					</a>
					</td>
					<td class="button" id="toolbar-cancel">
					<a href="javascript:;//Đóng" id="lnkClose" class="toolbar">
						<span class="icon-32-cancel" title="Đóng"></span>
						Đóng
					</a>
					</td>
				</tr>
				</table>
				</div>
				<div class="header icon-48-langmanager">Thêm danh mục tin tức</div>
				<div class="clr"></div>
			</div>
			<div class="b"><div class="b"><div class="b"></div></div></div>
			</div>
			<div class="clr"></div>
			<div id="element-box">
				<div class="t"><div class="t"><div class="t"></div></div></div>
				<div class="m">
				<form action="<?php echo DOMAIN?>/category_news/add" method="post" name="adminForm" enctype="multipart/form-data" id="adminForm" autocomplete="off">
					<div class="col width-60">
						<fieldset class="adminform">
						<legend>Thông tin chi tiết</legend>
						<table class="admintable" cellspacing="1">
						<tr>
							<td width="150" class="key">
								<label for="txtName">Tên danh mục</label>
							</td>
							<td>
								 <?php echo $form->input('Category.name',array( 'label' => '','id'=>'txtName','class'=>'inputbox','size'=>'80'));?>
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="ddlParent">Danh mục cha</label>
							</td>
							<td>
					  			<?php echo $form->select('Category.parent_id',$categorylist, null,array('empty'=>'-- Danh mục gốc --','id'=>'ddlParent'));?> 
							</td>
						</tr>
					   <tr style="display:none;">
							<td class="key">
								<label for="ddlType">Loại tin</label>
							</td>
							<td>
								<select id="ddlType" name="ddlType">
									<option value="0" <?php //echo select(0,$type);?>>- Bài viết -</option>
								</select>
							</td>
						</tr>
						<tr  style="display:none;">
							<td class="key">
								<label for="ddlLocal">Vị trí</label>
							</td>
							<td class="keke" >
								            
								<ul >
							   <li > <?php	echo $this->Form->input('Category.dm_vitri',array('type'=>'checkbox','label'=>false,'class'=>'')); ?> Menu trên</li>
                              <!--   <li ><?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?> Menu footer</li>
                                 <li> <?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?> Menu trái</li>
                                  <li > <?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?> Menu dưới</li>
                                  <li>  <?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?> Trang chủ (Giới thiệu)</li>
                                    <li > <?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?>  Trang chủ (Nội dung)</li>-->
                                    </ul>
							</td>
						</tr>
                        <tr  style="display:none;">
                        	<td class="key">
								<label for="ddlType">Hiển thị trên trang</label>
							</td>
                            <td class="keke">  
                            <?php	echo $this->Form->input('Category.dm_vitrihienthi',array('type'=>'checkbox','label'=>false,'class'=>'')); ?> Trang chủ                              
                            <!-- <ul >
							   <li > <?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?> Trang chủ</li>
                                 <li ><?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?>Giới thiệu</li>
                                 <li> <?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?> Tin tức</li>
                                  <li > <?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?> Sản phẩm và dịch vụ</li>
                                  <li>  <?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?> Thư viện & tài liệu</li>
                                    <li > <?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?>   Tuyển dụng</li>
                                    <li > <?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?>   Đối tác và khách hàng </li>
                                     <li > <?php	echo $this->Form->input('Category.dm_trangthai',array('type'=>'checkbox','label'=>false,'class'=>'')); ?>  Liên hệ </li>
                                    </ul>--></td>
                        </tr>
						<tr style="display:none;">
							<td class="key">
								<label for="ddlLocal"></label>
							</td>
							<td>
								<?php echo $form->radio('Category.cols', array(0 => 'Cột trái', 1 => 'Cột phải'), array('value' => '1','legend'=>'')); ?>
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="txtOrder">Thứ tự</label>
							</td>
							<td>
								<?php echo $form->input('Category.order',array( 'label' => '','id'=>'txtOrder','class'=>'inputbox','size'=>'40','onkeypress'=>'return keypress(event);'));?>
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="txtImage">Icon</label>
							</td>
							<td>
							 <?php echo $this->Form->input('Category.imagges',array('class'=>'inputbox','id'=>'txtImage','size'=>'40','label'=>false,'readonly'=>true,'id'=>'imagesid')); ?> 
    <div style="position:relative; top:-20px; left:240px;"><a href="javascript:window.open('<?php echo DOMAIN; ?>/upload.php','images','left=400,top=100,width=500,height=300');window.history.go(1)">Upload</a></div>
    <div class="functionBtnEvent" style="width:100%; padding-left:11px;"><img id="images-default" name="imagesdefault" src="<?php echo DOMAIN ?>/img/no-images.jpg" width="100"></img></div>
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="txtDescription">Mô tả</label>
							</td>
							<td>
							<?php  echo $this->Form->input('Category.introduction',array('label'=>'')).$this->TvFck->create('Category.introduction',array('toolbar'=>'extra','height'=>'150px','width'=>'600')); ?>
							</td>
							</td>
						</tr>
						
						</table>
						</fieldset>
					</div>
					<div class="col width-40">
						<fieldset class="adminform">
						<legend>Mở rộng</legend>
						<table cellspacing="1" class="admintable">
						<tbody>
						<tr>
							<td class="key">
								<label for="chekActive">Trạng thái</label>
							</td>
							<td>
								<?php	echo $this->Form->input('Category.status',array('type'=>'checkbox','label'=>false,'class'=>'inputbox','id'=>'chekActive','onclick'=>'Checkvalue("chekActive")','style'=>'width:0px;')); ?>
								<label id="lbActive">Hoạt động</label>
							</td>
						</tr>
						<tr  style="display:none;">
							<td class="key">
								<label for="chekActive">Hiển thị ngày giờ</label>
							</td>
							<td>
							 <?php	echo $this->Form->input('Category.display_time',array('type'=>'checkbox','label'=>false,'class'=>'inputbox','id'=>'chekActive','onclick'=>'Checkvalue("chekDisplayTime")','style'=>'width:0px;')); ?>
								<label id="lbActive">Có</label>
							</td>
						</tr>
						<tr <?php // if($id!=0) echo "style='display:none;'"?>>
							<td class="key">
								<label for="chekActive">Tiếp tục cập nhật</label>
							</td>
							<td>
								<?php	echo $this->Form->input('Category.check',array('type'=>'checkbox','label'=>false,'class'=>'inputbox','id'=>'chekContinous','onclick'=>'Checkvalue("chekContinous")','style'=>'width:0px;')); ?>
								<label id="lbActive">Có</label>
							</td>
						</tr>
						
						<tr>
							<td class="key">
								<label for="listnhom">Ngày tạo</label>
							</td>
							<td>
								<?php  $time = time(); echo date("d-m-Y",$time); ?>
							</td>
						</tr>
						</tbody></table>
						</fieldset>
						<fieldset class="adminform">
						<legend>Meta Data</legend>
						<table cellspacing="1" class="admintable">
						<tbody>
						<tr>
							<td width="150" class="key">
								<label for="txtMetaTitle">Meta Title</label>
							</td>
							<td>
								
                                 <?php  echo $this->Form->input('Category.title', array('cols'=>50, 'rows'=>5, 'type'=>'textarea','label'=>'','id'=>'txtMetaTitle'));?> 
							</td>
						</tr>
						<tr>
							<td width="150" class="key">
								<label for="txtMetaKeyword">Meta Keyword</label>
							</td>
							<td>
								
                                
                                 <?php  echo $this->Form->input('Category.keyword', array('cols'=>50, 'rows'=>5, 'type'=>'textarea','label'=>'','id'=>'txtMetaKeyword'));?> 
                               
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="txtMetaDescription">Meta Description</label>
							</td>
							<td>
								  <?php  echo $this->Form->input('Category.description', array('cols'=>50, 'rows'=>5, 'type'=>'textarea','label'=>'','id'=>'txtMetaDescription'));?> 
							</td>
						</tr>
						</tbody></table>
						</fieldset>
					</div>
					<div class="clr"></div>
					
				</form>
				<div class="clr"></div>
				</div>
				<div class="b"><div class="b"><div class="b"></div></div></div>
			</div>
			<noscript>Warning! JavaScript must be enabled for proper operation of the Administrator back-end.</noscript>
			<div class="clr"></div>
		</div>
		<div class="clr"></div>
	</div>
</div>
